<template>
  <div>
    <el-dialog
      :visible="true"
      :title="title"
      class="add_case_dialog"
      width="90%"
      :before-close="callOf"
    >
      <el-form ref="form" :model="sizeForm" label-width="100px">
        <el-row :gutter="5">
          <el-col :span="14">
            <el-row :gutter="10" style="margin-top: 10px">
              <el-col :span="3">
                <el-form-item label="关联">
                  <el-switch
                    v-model="sizeForm.relation"
                    style="margin-right: 20px"
                    disabled
                    active-color="#13ce66"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="状态">
                  <el-select
                    v-model="sizeForm.project_info.status"
                    style="margin-left: 20px"
                    clearable
                    placeholder="状态"
                  >
                    <el-option
                      v-for="item in statusOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="需求类型">
                  <el-select
                    ref="demand_type"
                    v-model="sizeForm.project_info.demand_type"
                    style="margin-left: 20px"
                    clearable
                    placeholder="需求类型"
                    @change="set_default()"
                  >
                    <el-option
                      v-for="item in demandOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item label="实验室">
                  <el-select
                    v-model="sizeForm.pro_data.v_group"
                    clearable
                    placeholder="业务"
                    :disabled="edit"
                    @change="getAll(1)"
                  >
                    <el-option
                      v-for="item in pro_data.venvOptions.v_group"
                      :key="item.key"
                      :label="item.group_name"
                      :value="item.group_name"
                    />
                  </el-select>
                  <el-select
                    v-model="sizeForm.pro_data.v_project"
                    style="margin-left: 20px"
                    clearable
                    placeholder="项目"
                    :disabled="edit"
                    @change="getAll(2)"
                  >
                    <el-option
                      v-for="item in pro_data.venvOptions.v_project"
                      :key="item.key"
                      :label="item.project_name"
                      :value="item.project_name"
                    />
                  </el-select>

                  <el-select
                    v-model="sizeForm.pro_data.v_version"
                    style="margin-left: 20px"
                    filterable
                    allow-create
                    clearable
                    placeholder="版本"
                    :disabled="edit"
                    @change="getAll(3)"
                  >
                    <el-option
                      v-for="item in pro_data.venvOptions.v_version"
                      :key="item.key"
                      :label="item.version_name"
                      :value="item.version_name"
                    />

                  </el-select>
                  <el-tooltip style="margin-left: 20px" placement="top">
                    <div slot="content" class="tips-content text-tips-content">
                      <span>Tips :</span><br>
                      <div class="rule-box">
                        1、实验室版本下拉框中无所需版本，按照Mantis中所需版本手动编辑即可.<br>
                        2、Mantis版本下拉框中无所需版本，按照邮件中版本进行手动编辑即可.
                      </div>
                    </div>
                    <i class="el-icon-question" />
                  </el-tooltip>
                </el-form-item>
              </el-col>

            </el-row>
            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item label="Mantis">
                  <el-select
                    v-model="sizeForm.pro_data.m_group"
                    clearable
                    placeholder="业务"
                    :disabled="edit"
                    @change="getAll(4)"
                  >
                    <el-option
                      v-for="item in pro_data.mantisOptions.m_group"
                      :key="item.key"
                      :label="item.group_name"
                      :value="item.group_name"
                    />
                  </el-select>
                  <el-select
                    v-model="sizeForm.pro_data.m_project"
                    style="margin-left: 20px"
                    clearable
                    placeholder="项目"
                    :disabled="edit"
                    @change="getAll(5)"
                  >
                    <el-option
                      v-for="item in pro_data.mantisOptions.m_project"
                      :key="item.key"
                      :label="item.project_name"
                      :value="item.project_name"
                    />
                  </el-select>
                  <el-select
                    v-model="sizeForm.pro_data.m_version"
                    style="margin-left: 20px"
                    filterable
                    allow-create
                    clearable
                    :disabled="edit"
                    placeholder="版本-如无则手动编辑"
                    @change="getAll(6)"
                  >
                    <el-option
                      v-for="item in pro_data.mantisOptions.m_version"
                      :key="item.key"
                      :label="item.version_name"
                      :value="item.version_name"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="10">
            <el-row :gutter="10">
              <el-col :span="24">
                <div class="mark">
                  <span
                    style="
                      font-size: 15px;
                      font-weight: bold;
                      margin-left: 10px;
                    "
                    class="mark-item"
                  >发版统计</span>
                </div>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否上线">
                  <el-switch
                    v-model="sizeForm.project_info.online.online_status"
                    style="margin-right: 20px"
                    active-color="#13ce66"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="上线时间">
                  <el-date-picker
                    v-model="sizeForm.project_info.online_time"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy-MM-dd"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="6">
                <el-form-item label="是否按时上线">
                  <el-switch
                    v-model="sizeForm.project_info.online.onlineanshi"
                    style="margin-right: 20px"
                    active-color="#13ce66"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="上线次数">
                  <el-input
                    v-model="sizeForm.project_info.online.online_count"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="10">
                <el-form-item label="回滚/追加次数">
                  <el-input
                    v-model="sizeForm.project_info.online.back"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="15">
            <el-row :gutter="10">
              <el-col :span="24">
                <div class="mark">
                  <span
                    style="
                      font-size: 15px;
                      font-weight: bold;
                      margin-left: 10px;
                    "
                    class="mark-item"
                  >项目数据</span>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="8">
                <el-form-item label="开始时间">
                  <el-date-picker
                    v-model="sizeForm.project_info.start_time"
                    class="buginput"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy-MM-dd"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="结束时间">
                  <el-date-picker
                    v-model="sizeForm.project_info.end_time"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy-MM-dd"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="研发工时">
                  <el-input
                    v-model="sizeForm.project_info.dev_time"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="检查点数量">
                  <el-input
                    v-model="sizeForm.project_info.cheack"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="4">
                <el-form-item label="提测次数">
                  <el-input
                    v-model="sizeForm.project_info.tice"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="是否按时准入">
                  <!-- <el-input
                    v-model="sizeForm.project_info.ticeanshi"
                    class="buginput"
                    placeholder=""
                  /> -->
                  <el-switch
                    v-model="sizeForm.project_info.ticeanshi"
                    style="margin-right:20px"
                    active-color="#13ce66"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="准入次数">
                  <el-input
                    v-model="sizeForm.project_info.zhunru"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="是否按时准出">
                  <!-- <el-input
                    v-model="sizeForm.project_info.zhunchuanshi"
                    class="buginput"
                    placeholder=""
                  /> -->
                  <el-switch
                    v-model="sizeForm.project_info.zhunchuanshi"
                    style="margin-right: 20px"
                    active-color="#13ce66"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="准出次数">
                  <el-input
                    v-model="sizeForm.project_info.zhunchu"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>

            </el-row>
            <el-row :gutter="10">
              <el-col :span="24">
                <div class="mark">
                  <span
                    style="
                      font-size: 15px;
                      font-weight: bold;
                      margin-left: 10px;
                    "
                    class="mark-item"
                  >bug数据</span>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="4">
                <el-form-item label="本版本遗留">
                  <el-input
                    v-model="sizeForm.project_info.bug_Legacy.nofix_bug"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="之前版本遗留">
                  <el-input
                    v-model="sizeForm.project_info.bug_Legacy.ago"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="Bug总数">
                  <el-input
                    v-model="sizeForm.project_info.bug_Legacy.sum_bug"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="用户体验类">
                  <el-input
                    v-model="sizeForm.project_info.pm_bug.use_bug"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="需求变更">
                  <el-input
                    v-model="sizeForm.project_info.pm_bug.pm_fix"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="Reopen">
                  <el-input
                    v-model="sizeForm.project_info.mantis.reopen"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="4">
                <el-form-item label="Smoke_Bug">
                  <el-input
                    v-model="sizeForm.project_info.smoke_bug"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="首轮bug数">
                  <el-input
                    v-model="sizeForm.project_info.frist_bug"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="P1">
                  <el-input
                    v-model="sizeForm.project_info.mantis.P1"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="P2">
                  <el-input
                    v-model="sizeForm.project_info.mantis.P2"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="P3">
                  <el-input
                    v-model="sizeForm.project_info.mantis.P3"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="P4">
                  <el-input
                    v-model="sizeForm.project_info.mantis.P4"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="P5">
                  <el-input
                    v-model="sizeForm.project_info.mantis.P5"
                    class="buginput"
                    placeholder=""
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

          <el-col :span="9">
            <el-row :gutter="10">
              <el-col :span="24">
                <div class="mark">
                  <span
                    style="
                      font-size: 15px;
                      font-weight: bold;
                      margin-left: 10px;
                    "
                    class="mark-item"
                  >项目备注</span>
                </div>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="24">
                <el-input
                  v-model="sizeForm.pquest"
                  type="textarea"
                  :rows="5"
                  placeholder="项目问题"
                />
              </el-col>
            </el-row>
            <el-row style="margin-top: 5%" :gutter="10">
              <el-col :span="24">
                <el-input
                  v-model="sizeForm.remark"
                  type="textarea"
                  :rows="5"
                  placeholder="备注说明"
                />
              </el-col>
            </el-row>
          </el-col>
        </el-row>

        <el-row :gutter="10">
          <el-form-item align="center">
            <el-button type="danger" @click="callOf('form')">取消</el-button>
            <el-button
              type="primary"
              style="margin-left: 210px"
              @click="dialogFormAdd('form')"
            >保存</el-button>
          </el-form-item>
        </el-row>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
import { Message } from 'element-ui'
import { getProject, addProject } from '@/api/quality'
import { getAllinfo, verificationCollectVersion } from '@/api/quality'

export default {
  name: 'Task',
  props: {
    // dialogAdd: Object,
    sizeForms: {
      type: Object,
      required: true
    },
    edit: Boolean,
    title: {
      type: String,
      required: true
    }
  },

  data() {
    return {
      integer_v: /^\+?[0-9][0-9]*$/,
      integer_v_one: /^[1-9][0-9]*([\.][0-9]{1,1})?$/,
      need: {
        need_data: [],
        have_data: {}
      },
      pro_data: {
        venvOptions: {
          v_group: '',
          v_project: '',
          v_version: ''
        },
        mantisOptions: {
          m_group: '',
          m_project: '',
          m_version: ''
        }
      },
      sizeForm: {
        pquest: '',
        remark: '',
        pro_data: {
          v_group: '',
          v_project: '',
          v_version: '',
          m_group: '',
          m_project: '',
          m_version: ''
        },
        project_info: {
          demand_type: '',
          status: '',
          start_time: '',
          end_time: '',
          online_time: '',
          pro_id: '0',
          mantis: { P1: '', P2: '', P3: '', P4: '', P5: '', reopen: '' },
          tice: '',
          ticeanshi: false,
          zhunru: '',
          zhunchu: '',
          zhunchuanshi: false,
          cheack: '',
          smoke_bug: '',
          frist_bug: '',
          bug_Legacy: { nofix_bug: '', sum_bug: '', ago: '' },
          pm_bug: { use_bug: '', pm_fix: '' },
          dev_time: '',
          online: {
            online_status: false,
            onlineanshi: false,
            online_count: '',
            back: ''
          }
        },
        relation: false,
        creater: ''
      },
      statusOptions: [
        { value: 1, label: '测试中' },
        { value: 2, label: '测试完成' },
        { value: 3, label: '已上线' }
      ],
      demandOptions: [
        { value: 1, label: '标准需求' },
        { value: 2, label: '验收需求' },
        { value: 3, label: '生产事故' },
        { value: 4, label: '线上bug' },
        { value: 5, label: '紧急发版' }
      ],
      info: {
        demand_type: '需求类型',
        status: '项目状态',
        start_time: '开始时间',
        end_time: '测试完成时间',
        online_time: '上线时间',
        pro_id: '判断是否为编辑字段',
        P1: 'P1 Bug数量',
        P2: 'P2 Bug数量',
        pm_bug: '需求变更',
        P3: 'P3 Bug数量',
        P4: 'P4 Bug数量',
        P5: 'P5 Bug·数量',
        reopen: '重新打开Bug数量',
        tice: '提测次数',
        ticeanshi: '按时提测次数',
        zhunru: '准入次数',
        zhunchu: '准出次数',
        zhunchuanshi: '按时准出次数',
        cheack: '检查点数量',
        smock_bug: '冒烟bug数',
        frist_bug: '首轮bug数',
        v_group: '实验室业务线',
        v_project: '实验室项目名称',
        v_version: '实验室版本号',
        m_group: 'mantis业务线',
        m_project: 'mantis项目名称',
        dev_time: '研发工时',
        m_version: 'mantis版本号',
        online_count: '发版次数',
        back: '回滚/追加次数',
        nofix_bug: '遗留bug数',
        ago: '之前版本遗留bug数量',
        sum_bug: 'Bug总数',
        use_bug: '用户体验类bug数量',
        pm_fix: '需求变更次数'
      }
    }
  },
  mounted() {
    this.getGroupName()
  },
  methods: {
    formateDate(dateformate) {
      var date = new Date(dateformate)
      var y = date.getFullYear()
      var m = date.getMonth() + 1
      var d = date.getDate()
      // var h = date.getHours();
      // var mi = date.getMinutes();
      m = m > 9 ? m : '0' + m
      // alert("y:"+y+"m:"+m+"d:"+d+"h:"+h+"mi:"+mi);
      return y + '-' + m + '-' + d
    },
    dialogFormAdd(form) {
      if (!this.Effectiveness()) {
        return false
      }
      if (this.sizeForm.project_info.online_time !== '' && this.sizeForm.project_info.online_time) {
        this.sizeForm.project_info.online_time = this.formateDate(
          this.sizeForm.project_info.online_time
        )
      } else {
        this.sizeForm.project_info.online_time = ''
      }
      if (this.sizeForm.project_info.end_time !== '' && this.sizeForm.project_info.end_time) {
        this.sizeForm.project_info.end_time = this.formateDate(
          this.sizeForm.project_info.end_time
        )
      } else {
        this.sizeForm.project_info.end_time = ''
      }
      if (this.sizeForm.project_info.start_time !== '' && this.sizeForm.project_info.start_time) {
        this.sizeForm.project_info.start_time = this.formateDate(
          this.sizeForm.project_info.start_time
        )
      } else {
        this.sizeForm.project_info.start_time = ''
      }
      if (!this.Effectiveness_int()) {
        return false
      }
      this.$refs[form].validate((valid) => {
        if (valid) {
          this.sizeForm.creater = this.sizeForms.creater
          if (this.edit) {
            addProject(this.sizeForm)
              .then((res) => {
                Message.success(res.message)
              })
              .catch((err) => {
                Message.error(err.msg || err.message || err.value)
              })
          } else {
            addProject(this.sizeForm).then((res) => {
              if (res.code === 20000) {
                Message.success(res.message)
              } else {
                Message.error(res.message)
              }
            })
          }
          this.callOf()
          this.$parent.getList()
        } else {
          return false
        }
      })
    },
    Effectiveness() {
      const arrl = [
        'online_time',
        'frist_bug',
        'smoke_bug',
        'end_time',
        'zhunchuanshi',
        'zhunchu',
        'online_count',
        'back',
        'ago',
        'nofix_bug',
        'sum_bug',
        'use_bug',
        'pm_fix',
        'P1',
        'P2',
        'P3',
        'P4',
        'P5',
        'reopen'
      ]
      for (var i in this.sizeForm.pro_data) {
        if (this.sizeForm.pro_data[i] === '') {
          if (!arrl.includes(i)) {
            this.get_Effectiveness(i)
            return false
          }
        }
      }
      for (var o in this.sizeForm.project_info) {
        if (this.sizeForm.project_info[o] === '') {
          if (!arrl.includes(o)) {
            this.get_Effectiveness(o)
            return false
          }
        }
      }
      for (var p in this.sizeForm.project_info.mantis) {
        if (this.sizeForm.project_info.mantis[p] === '') {
          if (!arrl.includes(p)) {
            this.get_Effectiveness(p)
            return false
          }
        }
      }
      for (var u in this.sizeForm.project_info.pm_bug) {
        if (this.sizeForm.project_info.pm_bug[u] === '') {
          if (!arrl.includes(u)) {
            this.get_Effectiveness(u)
            return false
          }
        }
      }
      for (var s in this.sizeForm.project_info.bug_Legacy) {
        if (this.sizeForm.project_info.bug_Legacy[s] === '') {
          if (!arrl.includes(s)) {
            this.get_Effectiveness(s)
            return false
          }
        }
      }
      // for (var t in this.sizeForm.project_info.online) {
      //   if (this.sizeForm.project_info.online[t] === '') {
      //     this.get_Effectiveness(t)
      //     return false
      //   }
      // }
      return true
    },
    // conds() {
    //   alert(this.sizeForm.project_info.demand_type)
    //   alert(this.sizeForm.project_info.status)
    // },
    Effectiveness_int() {
      const arr2 = [
        'dev_time',
        'cheack',
        'tice',
        // 'ticeanshi',
        'zhunru',
        'zhunchu',
        // 'zhunchuanshi',
        'smoke_bug',
        'frist_bug',
        'nofix_bug',
        'ago',
        'sum_bug',
        'use_bug',
        'pm_fix',
        'reopen',
        'P1',
        'P2',
        'P3',
        'P4',
        'P5',
        'online_count',
        'back'
      ]
      for (var i in this.sizeForm.project_info) {
        if (this.sizeForm.project_info[i] !== '' && this.sizeForm.project_info[i]) {
          if (arr2.includes(i)) {
            if (i === 'dev_time') {
              if (!this.integer_v_one.test(this.sizeForm.project_info[i])) {
                Message.error(this.info[i] + '最多保留一位小数')
                return false
              }
            } else {
              if (!this.integer_v.test(this.sizeForm.project_info[i])) {
                this.get_Effectiveness_int(i)
                return false
              }
            }
          }
        }
      }
      for (var a in this.sizeForm.project_info.bug_Legacy) {
        if (this.sizeForm.project_info.bug_Legacy[a] !== '' && this.sizeForm.project_info.bug_Legacy[a]) {
          if (arr2.includes(a)) {
            if (!this.integer_v.test(this.sizeForm.project_info.bug_Legacy[a])) {
              this.get_Effectiveness_int(a)
              return false
            }
          }
        }
      }
      for (var e in this.sizeForm.project_info.pm_bug) {
        if (this.sizeForm.project_info.pm_bug[e] !== '' && this.sizeForm.project_info.pm_bug[e]) {
          if (arr2.includes(e)) {
            if (!this.integer_v.test(this.sizeForm.project_info.pm_bug[e])) {
              this.get_Effectiveness_int(e)
              return false
            }
          }
        }
      }
      for (var r in this.sizeForm.project_info.mantis) {
        if (this.sizeForm.project_info.mantis[r] !== '' && this.sizeForm.project_info.mantis[r]) {
          if (arr2.includes(r)) {
            if (!this.integer_v.test(this.sizeForm.project_info.mantis[r])) {
              this.get_Effectiveness_int(r)
              return false
            }
          }
        }
      }
      for (var t in this.sizeForm.project_info.online) {
        if (this.sizeForm.project_info.online[t] !== '' && this.sizeForm.project_info.online[t]) {
          if (arr2.includes(t)) {
            if (!this.integer_v.test(this.sizeForm.project_info.online[t])) {
              this.get_Effectiveness_int(t)
              return false
            }
          }
        }
      }
      return true
    },
    set_default() {
      var arr = [3, 4, 5]
      if (arr.includes(this.sizeForm.project_info.demand_type)) {
        this.sizeForm.project_info = {
          demand_type: this.demandOptions[
            this.sizeForm.project_info.demand_type - 1
          ].label,
          status: 3,
          start_time: this.get_NowFormatDate(),
          end_time: this.get_NowFormatDate(),
          online_time: this.get_NowFormatDate(),
          pro_id: '0',
          smoke_bug: '0',
          mantis: { P1: '0', P2: '0', P3: '0', P4: '0', P5: '0', reopen: '0' },
          tice: '1',
          ticeanshi: true,
          zhunru: '1',
          zhunchu: '1',
          zhunchuanshi: true,
          cheack: '0',
          frist_bug: '0',
          bug_Legacy: { nofix_bug: '0', sum_bug: '0', ago: '0' },
          pm_bug: { use_bug: '0', pm_fix: '0' },
          dev_time: '1',
          online: {
            online_status: true,
            onlineanshi: true,
            online_count: '1',
            back: ''
          }
        }
      }
      // this.conds()
    },

    get_Effectiveness(name) {
      Message.error(this.info[name] + '为必填项!')
    },
    get_Effectiveness_int(n) {
      Message.error(this.info[n] + '必须为整数!')
    },
    get_NowFormatDate() {
      var date = new Date()
      return date
    },
    getAll(n) {
      if (n === 1) {
        this.sizeForm.pro_data.m_group = ''
        this.sizeForm.pro_data.v_project = ''
        this.sizeForm.pro_data.m_project = ''
        this.sizeForm.pro_data.v_version = ''
        this.sizeForm.pro_data.m_version = ''
        getAllinfo(this.sizeForm.pro_data)
          .then((res) => {
            // alert(JSON.stringify(res.data))
            this.pro_data.mantisOptions.m_project =
              res.data.pro_data.mantisOptions.m_project
            this.pro_data.venvOptions.v_project =
              res.data.pro_data.venvOptions.v_project
            this.sizeForm.pro_data = res.data.sizeForm.pro_data
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      } else if (n === 4) {
        this.sizeForm.pro_data.v_group = ''
        this.sizeForm.pro_data.v_project = ''
        this.sizeForm.pro_data.m_project = ''
        this.sizeForm.pro_data.v_version = ''
        this.sizeForm.pro_data.m_version = ''
        getAllinfo(this.sizeForm.pro_data)
          .then((res) => {
            // alert(JSON.stringify(res.data))
            this.pro_data.mantisOptions.m_project =
              res.data.pro_data.mantisOptions.m_project
            this.pro_data.venvOptions.v_project =
              res.data.pro_data.venvOptions.v_project
            this.sizeForm.pro_data = res.data.sizeForm.pro_data
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      } else if (n === 2) {
        this.sizeForm.pro_data.m_project = ''
        this.sizeForm.pro_data.v_version = ''
        this.sizeForm.pro_data.m_version = ''
        getAllinfo(this.sizeForm.pro_data)
          .then((res) => {
            this.pro_data.mantisOptions.m_version =
              res.data.pro_data.mantisOptions.m_version
            this.pro_data.venvOptions.v_version =
              res.data.pro_data.venvOptions.v_version
            this.sizeForm.pro_data = res.data.sizeForm.pro_data
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      } else if (n === 5) {
        this.sizeForm.pro_data.v_project = ''
        this.sizeForm.pro_data.v_version = ''
        this.sizeForm.pro_data.m_version = ''
        getAllinfo(this.sizeForm.pro_data)
          .then((res) => {
            this.pro_data.mantisOptions.m_version =
              res.data.pro_data.mantisOptions.m_version
            this.pro_data.venvOptions.v_version =
              res.data.pro_data.venvOptions.v_version
            this.sizeForm.pro_data = res.data.sizeForm.pro_data
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      } else if (n === 3) {
        verificationCollectVersion(this.sizeForm.pro_data)
          .then((res) => {
            if (res.data) {
              getAllinfo(this.sizeForm.pro_data)
                .then((res) => {
                  this.sizeForm.project_info.dev_time = res.data.sizeForm.dev_time
                  this.sizeForm.relation = res.data.sizeForm.relation
                })
                .catch((error) => {
                  Message.error(error.msg || error.message || error.value)
                })
            } else {
              Message.error(this.sizeForm.pro_data.v_version + '已经关联过mantis项目,请选择其他实验室版本！')
            }
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      } else if (n === 6) {
        verificationCollectVersion(this.sizeForm.pro_data)
          .then((res) => {
            if (res.data) {
              getAllinfo(this.sizeForm.pro_data)
                .then((res) => {
                  this.sizeForm.relation = res.data.sizeForm.relation
                  this.sizeForm.project_info.mantis = res.data.sizeForm.mantis
                  this.sizeForm.project_info.bug_Legacy =
                        res.data.sizeForm.bug_Legacy
                  this.sizeForm.project_info.pm_bug = res.data.sizeForm.pm_bug
                  this.sizeForm.project_info.frist_bug = res.data.sizeForm.frist_bug
                  this.sizeForm.project_info.smoke_bug = res.data.sizeForm.smoke_bug
                })
                .catch((error) => {
                  Message.error(error.msg || error.message || error.value)
                })
            } else {
              Message.error(this.sizeForm.pro_data.m_version + '已录入,请选择其他mantis版本！')
            }
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      }
    },
    getGroupName() {
      this.pro_data.venvOptions.v_group = this.sizeForms.venus_f_list // 获取看板一级数据
      this.pro_data.mantisOptions.m_group = this.sizeForms.mantis_f_list // 获取mantis一级数据
      if (this.sizeForms.edit) {
        this.get_Project()
      }
    },
    get_Project() {
      if (this.sizeForms.pro_id !== '0') {
        getProject(this.sizeForms.pro_id)
          .then((res) => {
            this.sizeForm = res.data
          })
          .catch((error) => {
            Message.error(error.msg || error.message || error.value)
          })
      }
    },
    callOf() {
      this.$emit('closePop')
    }
  }
}
</script>
<style type="text/css">
.buginput {
  width: 59px;
}

.mark {
  border-radius: 4px;
  margin: 10px 0 30px;
  background-color: rgba(175, 196, 225, 0.8);
  height: 30px;
  line-height: 30px;
  color: #fff;
}
</style>>
